#include<iostream>
#include<cstdio>
#include<cstring>

using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int maxn = 1000001;

ll quickpw(ll a, ll b) {
    ll ans = 1, base = a;
    while (b != 0) {
        if (b & 1 != 0)
            ans = ans * base % mod;
        base = base * base % mod;
        b >>= 1;
    }
    return ans % mod;
}

char c[maxn];

int main() {
    while (~scanf("%s", c)) {
        ll a[11];
        ll ans = 1;
        memset(a, 0, sizeof(a));
        int len = strlen(c);
        for (int i = 0; i < len; i++) {
            a[c[i] - '0'] += (i + 1);
        }
        for (int i = 0; i < 11; i++) {
            if (a[i]) {
                ans = ans * quickpw(i, a[i]) % mod;
            }
        }
        cout << ans % mod << endl;
    }
    return 0;
}
